<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:t="http://myfaces.apache.org/tomahawk">
<body>
<ui:composition template="../template/adminTemplate.jsp">
	<ui:define name="title">
		List User
	</ui:define>
	<ui:define name="body">
		<h:form>
			<t:dataTable value="#{userBackingBean.allUsers}" var="user" id="userList"
			rowClasses="list-row-even, list-row-odd">
				<h:column>
					<f:facet name="header">
						<h:outputText value="ID" />
					</f:facet>
					<h:outputText value="#{user.id}" />
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="Username" />
					</f:facet>
					<h:outputText value="#{user.username}" />
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="Enabled" />
					</f:facet>
					<h:outputText value="#{user.enabled}" />
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="Role" />
					</f:facet>
					<ul class="rolesList">
						<ui:repeat value="#{user.authorities}" var="role">
							<li><h:outputText value="#{role.description}" /></li>
						</ui:repeat>
					</ul>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="" />
					</f:facet>
					<h:commandLink id="editUserLink" action="#{userBackingBean.editUser}">
						<h:outputText value="edit" />
					</h:commandLink>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="" />
					</f:facet>
					<h:commandLink id="deleteUserLink" action="#{userBackingBean.deleteUser}" onclick="return confirm('You are deleting the selected user.');">
						<h:outputText value="delete" />
					</h:commandLink>
				</h:column>
			</t:dataTable>
			<h:commandLink id="createUserLink" action="#{userBackingBean.createUser}">
				<h:outputText value="Create User"></h:outputText>
			</h:commandLink>
		</h:form>
	</ui:define>
</ui:composition>
</body>
</html>
